{% extends "admin/common_base.html" %}

{% block main %}
    <div class="main">
        <div class="body container">
            <div class="typecho-page-title">
                <h2>永久链接设置</h2>
            </div>
            <div class="row typecho-page-main" role="form">
                <div class="col-mb-12 col-tb-8 col-tb-offset-2">
                    <form action="http://www.typecho.local/index.php/action/options-permalink?_=aa05dcc8e72a293b39323a4245bb1e26" method="post"
                        enctype="application/x-www-form-urlencoded">
                        <ul class="typecho-option" id="typecho-option-item-rewrite-0">
                            <li>
                                <label class="typecho-label">
                                    是否使用地址重写功能</label>
                                <span>
                                    <input name="rewrite" type="radio" value="0" id="rewrite-0" checked="true" />
                                    <label for="rewrite-0">
                                        不启用</label>
                                </span>
                                <span>
                                    <input name="rewrite" type="radio" value="1" id="rewrite-1" />
                                    <label for="rewrite-1">
                                        启用</label>
                                </span>
                                <p class="description">
                                    地址重写即 rewrite 功能是某些服务器软件提供的优化内部连接的功能.
                                    <br />打开此功能可以让你的链接看上去完全是静态地址.</p>
                            </li>
                        </ul>
                        <ul class="typecho-option" id="typecho-option-item-postPattern-1">
                            <li>
                                <label class="typecho-label">
                                    自定义文章路径</label>
                                <span class="multiline">
                                    <input name="postPattern" type="radio" value="/archives/[cid:digital]/" id="postPattern-archives-cid-digital" checked="true"
                                    />
                                    <label for="postPattern-archives-cid-digital">
                                        默认风格
                                        <code>/archives/{cid}/</code>
                                    </label>
                                </span>
                                <span class="multiline">
                                    <input name="postPattern" type="radio" value="/archives/[slug].html" id="postPattern-archives-slug-html" />
                                    <label for="postPattern-archives-slug-html">
                                        wordpress风格
                                        <code>/archives/{slug}.html</code>
                                    </label>
                                </span>
                                <span class="multiline">
                                    <input name="postPattern" type="radio" value="/[year:digital:4]/[month:digital:2]/[day:digital:2]/[slug].html" id="postPattern-year-digital-4-month-digital-2-day-digital-2-slug-html"
                                    />
                                    <label for="postPattern-year-digital-4-month-digital-2-day-digital-2-slug-html">
                                        按日期归档
                                        <code>/archives/{year}/{month}/{day}/{slug}.html</code>
                                    </label>
                                </span>
                                <span class="multiline">
                                    <input name="postPattern" type="radio" value="/[category]/[slug].html" id="postPattern-category-slug-html" />
                                    <label for="postPattern-category-slug-html">
                                        按分类归档
                                        <code>/{category}/{slug}.html</code>
                                    </label>
                                </span>
                                <span class="multiline">
                                    <input name="postPattern" type="radio" value="custom" id="postPattern-custom" />
                                    <label for="postPattern-custom">
                                        个性化定义
                                        <input type="text" class="w-50 text-s mono" name="customPattern" value="" />
                                    </label>
                                </span>
                                <p class="description">
                                    可用参数:
                                    <code>{cid}</code> 日志 ID,
                                    <code>{slug}</code> 日志缩略名,
                                    <code>{category}</code> 分类,
                                    <code>{directory}</code> 多级分类,
                                    <code>{year}</code> 年,
                                    <code>{month}</code> 月,
                                    <code>{day}</code> 日
                                    <br />选择一种合适的文章静态路径风格, 使得你的网站链接更加友好.
                                    <br />一旦你选择了某种链接风格请不要轻易修改它.</p>
                            </li>
                        </ul>
                        <ul class="typecho-option" id="typecho-option-item-pagePattern-2">
                            <li>
                                <label class="typecho-label" for="pagePattern-0-3">
                                    独立页面路径</label>
                                <input id="pagePattern-0-3" name="pagePattern" type="text" class="mono w-60" value="/{slug}.html" />
                                <p class="description">
                                    可用参数:
                                    <code>{cid}</code> 页面 ID,
                                    <code>{slug}</code> 页面缩略名
                                    <br />请在路径中至少包含上述的一项参数.</p>
                            </li>
                        </ul>
                        <ul class="typecho-option" id="typecho-option-item-categoryPattern-3">
                            <li>
                                <label class="typecho-label" for="categoryPattern-0-4">
                                    分类路径</label>
                                <input id="categoryPattern-0-4" name="categoryPattern" type="text" class="mono w-60" value="/category/{slug}/" />
                                <p class="description">
                                    可用参数:
                                    <code>{mid}</code> 分类 ID,
                                    <code>{slug}</code> 分类缩略名,
                                    <code>{directory}</code> 多级分类
                                    <br />请在路径中至少包含上述的一项参数.</p>
                            </li>
                        </ul>
                        <ul class="typecho-option typecho-option-submit" id="typecho-option-item-submit-4">
                            <li>
                                <button type="submit" class="btn primary">
                                    保存设置</button>
                            </li>
                        </ul>
                    </form>
                </div>
            </div>
        </div>
    </div>

    {% endblock %}

    {% block footer %}
    <script>
        (function () {
            $(document).ready(function () {
                var error = $('.typecho-option .error:first');

                if (error.length > 0) {
                    $('html,body').scrollTop(error.parents('.typecho-option').offset().top);
                }

                $('form').submit(function () {
                    if (this.submitted) {
                        return false;
                    } else {
                        this.submitted = true;
                    }
                });

                $('label input[type=text]').click(function (e) {
                    var check = $('#' + $(this).parents('label').attr('for'));
                    check.prop('checked', true);
                    return false;
                });
            });
        })();
    </script>
{% endblock %}